'use strict';var _Ed;
{let g,k,f,l,m;const d=_Ky.storage.sync;let y=(a,c)=>{"sync"==c?k||_nd(function*(){_Pt(a.del("asd"))||(yield v());if(f){let b=f;f=null;b()}}):"local"!=c||_Pt(a.del("LOCAL","__dummy__"))||(_Ed&&!l&&w("sameBrwr"==_Ed),g&&!m&&x(b=>{b&&b.size>b.quota&&_pd(["LOCAL","remoteSync"],"",0)}))},q,h=function(a){a=!!(null==a?_Ed||g:a);a==!q&&(_Ky.storage.onChanged[a?"addListener":"removeListener"](y),q=a)};var _Sw=function(a){_Ed=a;h()},_Ad=function(a){g=a;h()},_3=_wj(function*(){h(!0);yield _uf(a=>f=a,a=>d.set({["asd"]:Math.random()},
a));yield _9s(a=>f=a,_Pi(73>_Ok?2500:250));f=null;h()});let r=()=>a=>_2o()(c=>a(_uu(JSON.stringify(c),"UTF-8",!1))),t=a=>JSON.parse(_Cw(a,"UTF-8"));var _id=_wj(function*(){yield _3();var a=yield r();"compress"==g&&(a=yield _Mk(a));a=btoa(a);const c=d.QUOTA_BYTES_PER_ITEM-50;let b={};for(var e=0;e*c<a.length;++e)b[e]=a.substr(e*c,c);if(e>=d.QUOTA_BYTES/d.QUOTA_BYTES_PER_ITEM&&(a=JSON.stringify(b).length,a>d.QUOTA_BYTES))return{size:a,quota:d.QUOTA_BYTES};k=!0;yield n=>d.clear(n);yield n=>d.set(b,n);
k=!1});let u=a=>`settings${a?"_"+_si:""}.dat`,p=a=>c=>{const b=["LOCAL","localSyncTime"];a?_pd(b,a,0,c):_qf(...b)(c)};var _Ra=_wj(function*(a){(yield _ok(u(a),yield r()))||(yield p(Date.now()),yield _fw(_di,[_4d,{space:a?_si:""}]))});let w=_se(-500,(...a)=>_Ra(...a)()),x=_se(-600,a=>_id()(a));var _Kr=_wj(function*(){let a=yield b=>d.get(b),c="";for(let b=0;a[b];++b)c+=a[b];try{let b=atob(c),e=yield _cs(b);return[t(e),b!=e]}catch(b){}return[{}]}),_6t=_wj(function*(a,c){if(c)var b=yield p();a=yield _i(u(a),
null,b);!1!==a&&(yield p(Date.now()));try{return t(a.content)}catch(e){}return{}});let v=_wj(function*(){if(g){let [a]=yield _Kr();_Pt(a)||(_Ed&&(yield _Zp("add",a)),m=!0,yield _Hh(a),m=!1)}});var _ud=_Et(function*(a){_Ed&&(a=yield _6t("sameBrwr"==_Ed,a),_Pt(a)||(l=!0,yield _Hh(a),l=!1))}),_3a=a=>{a.space==("sameBrwr"==_Ed?_si:"")&&_ud()}};
